/*
 * AnalyzeCharges.h
 *
 *  Created on: May 26, 2011
 *      Author: marchi
 */

#ifndef ANALYZECHARGES_H_
#define ANALYZECHARGES_H_

#include "Metric.h"
#include "CellSymmetry.h"
#include "Voronoi.h"
#include "gmx_voronoi.h"

#include "VoronoiPrint.h"


using std::vector;
typedef::real Myreal;

static int nframes=0;
static CellSymmetry * symmetry=NULL;
gmx_ana_nbsearch_t  * Mynb=NULL;
static bool bHydrogen=FALSE;

static int AnalyzeVoronoi(t_topology *top, t_trxframe *fr, t_pbc *pbc,
              int nr, gmx_ana_selection_t *sel[], void *data)
{
    /* Here, you can do whatever analysis your program requires for a frame. */
    Voronoi & vor=*(static_cast<Voronoi *>(data));
	if(!symmetry) symmetry=new CellSymmetry(top,fr,pbc);
	symmetry->Center();

    Metric Met;
    Met(fr->box);

    ResidueCM MyRes;
    MyRes.SetCM(fr->x);
    MyRes.setMT(Met);
    MyRes.doCOtoOC();
    MyRes.pbc();
    atm.setCoord(Met,fr->x);
    atm.doCOtoOC();

    vor.Start(fr->time,atm);
    vor.getData();


    VoroOut << vor;

    nframes++;
    return 0;
}


#endif /* ANALYZECHARGES_H_ */
